﻿<!DOCTYPE html>

<!--我的培训-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>

</head>

<body>

    <div id="app" v-cloak>
        <el-form label-position=" right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">

                    <div class="new_title fl"><strong><img src="/static/images/icon1.png" />我的培训列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn-export-list url="/api/PX_Plan/ExportWDPX" :forminline="this.formInline" linetype="4"></btn-export-list>
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingPlanManagement.Trainingtime+'开始'+mark.m}}
                                </template>
                                <!-- <el-date-picker v-model="formInline.model.DiscoveryTimeBegin" type="date" slot="suffix" -->
                                <el-date-picker v-model="formInline.model.trainingBeginTime" type="date" slot="suffix"
                                                size="mini" placeholder="选择日期">
                                </el-date-picker>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingPlanManagement.Trainingtime+'结束'+mark.m}}
                                </template>
                                <!-- <el-date-picker v-model="formInline.model.DiscoveryTimeEnd" type="date" slot="suffix" -->
                                <el-date-picker v-model="formInline.model.trainingEndTime" type="date" slot="suffix"
                                                size="mini" placeholder="选择日期">
                                </el-date-picker>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
        </el-form>
        <el-col span="24">
            <el-table ref="table" stripe :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight"
                      border @selection-change="handleSelectionChange" row-style="height:10px"
                      style="width: 100%;height: 100%;">
                <!--<el-table-column type="selection" style="
        padding-top: 0px;
        padding-bottom: 0px;
    " align="center" width="55" :reserve-selection="true">
                </el-table-column>-->
                <!-- 除第一列以外 遍历所有字段 -->
                <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  下同-->
                <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                                 show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="trainingBeginTime" :label="Mytraining.Trainingtime" min-width="200">
                </el-table-column>
                <el-table-column prop="mark01" :label="Mytraining.trainingcourse" min-width="200"
                                 show-overflow-tooltip="true">
                </el-table-column>
                <!--<el-table-column prop="Trainingvenues" :label="Mytraining.Trainingvenues" min-width="200">
    </el-table-column>-->
                <el-table-column prop="target" :label="Mytraining.Trainingobjectives" min-width="200"
                                 show-overflow-tooltip="true">
                </el-table-column>
                <!--<el-table-column prop="Typesoftraining" :label="Mytraining.Typesoftraining" min-width="100">
    </el-table-column>-->
                <el-table-column prop="trainingcontent" :label="Mytraining.Trainingcontent" min-width="200"
                                 show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="mark02" :label="'培训方式'" min-width="200">
                </el-table-column>
                <el-table-column prop="mark03" :label="'考核方式'" min-width="200">
                </el-table-column>
                <el-table-column prop="mark07" :label="'培训计划状态'" min-width="200">
                </el-table-column>
                <el-table-column prop="mark04" :label="'状态'" min-width="200">
                </el-table-column>
                <el-table-column prop="mark09" :label="'已培训时长'" min-width="200">
                </el-table-column>
                <el-table-column prop="mark10" :label="'需培训时长'" min-width="200">
                </el-table-column>
                <el-table-column prop="mark05" :label="Mytraining.Score" min-width="200">
                </el-table-column>
                <el-table-column width="110" :label="'培训'" fixed="right">
                    <template slot-scope="scope">

                        <button type="button" class="elst-bt-xg" @click=PX('xg',scope.row.id,scope.row.mark08,scope.row.mark07,scope.row.mark02)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>
                <el-table-column width="110" :label="'模拟考试'" fixed="right">
                    <template slot-scope="scope">

                        <button type="button" class="elst-bt-xg" @click=MK('xg',scope.row.id,scope.row.mark07,scope.row.mark03)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>
                <el-table-column width="110" :label="'正式考试'" fixed="right">
                    <template slot-scope="scope">

                        <button type="button" class="elst-bt-xg" @click=ZK('xg',scope.row.id,scope.row.mark07,scope.row.mark03,scope.row.mark02,scope.row.mark06,scope.row.mark04)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>

                <el-table-column width="110" :label="col.btnFillinthereport" fixed="right">
                    <template slot-scope="scope">

                        <!-- <el-button type="primary" @click="UserInput('xg')">{{col.btnFillinthereport}}</el-button> -->

                        <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id,scope.row.mark04)>
                            
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>
            </el-table>
            <el-row type="flex" justify="end">

                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                               :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                               :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>


            </el-row>
            <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  -->
            <el-dialog :title="mytitle" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
                       top="10vh">
                <iframe ref="iframe" :src="ListItem.InputUrl" style="height:100%;width:100%" frameborder="0"></iframe>
            </el-dialog>

        </el-col>


    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                timer: null,
                mytitle:'',
                count: 1,
                clean: false,
                ListItem: ListItem,
                value1: '',
                TrainingMatrix: [],
                checked: true,
                isShow: true,
                formInline: {
                    value1: '',
                    // 遍历所有列 均为字符串即可
                    model: {
                        Name: '',
                        Category: '',
                        Teacher: '',
                        LlearningTime: '',
                        Courseware: '',
                        IsEncrypted: '',
                    },
                    offset: 0,
                    limit: 10
                }
            },
            mounted: function () {
                //获取下拉菜单内容

                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                closeDialog: function () {
                    closeDialog(this);
                },
                //Model 替换成 表名
                onDelete: function () {
                    onDelete(this, '/api/Mytraining/DeleteMuti');
                },

                handleSelectionChange: function (val) {
                    handleSelectionChange(this, val);
                },
                //Model 替换成 表名
                UserInput: function (val, id, tgzt) {
                    if (tgzt != '已通过') {
                        showMessage("请先通过本次培训再填写心得！", "error")
                        return;

                    }
                    DialogShow(this, val, "MytrainingInput.html", id);
                },
                timercz: function (id) {
                    var mythis = this;
                    setTimeout(function () {
                        
                       
                        if (mythis.ListItem.dialogVisible == true &&
                            mythis.ListItem.InputUrl.indexOf("20") == 1 ) {
                            mythis.$confirm('您已学习了' + mythis.count * 5 + '分钟,是否继续?', '提示', {
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                                type: 'warning'
                            }).then(function () {

                                myAjax("get", mythis, '/api/PX_PlanUser/AddTime?id=' + id, null, function (response) {

                                }, false);
                                mythis.timercz(id);

                            }).catch(function () {
                                myAjax("get", mythis, '/api/PX_PlanUser/AddTime?id=' + id, null, function (response) {
                                }, false);
                                mythis.ListItem.dialogVisible = false;
                            });
                        }
                        mythis.count++;
                    }, 1000 * 5);

                },

                PX: function (val, id, url, state, pxtype) {
                    if (pxtype == '线下') {
                        showMessage("请参与线下培训！", "error")
                        return;
                    }
                    if (state != '已开始') {
                        showMessage("培训已开始状态才能参与培训！", "error")
                        return;
                    }

                    this.mytitle = '线上培训';
                    this.timercz(id);

                    this.ListItem.InputUrl = url;
                    this.ListItem.dialogVisible = true;

                },
                ZK: function (val, id, state, extype,pxtype,pxsc,tgzt) {
                   
                    if (extype == '线下') {
                        showMessage("请参与线下考试！", "error")
                        return;
                    }
                    if (state != '已开始') {
                        showMessage("培训已开始状态才能参与考试！", "error")
                        return;
                    }
                    if (tgzt=='已通过') {
                        showMessage("您已经通过本次考试！无需再考！", "success")
                        return;

                    }

                    if (pxtype == '线上' && pxsc == '否') {
                        showMessage("培训时长不够！请继续学习！", "error")
                        return;
                    }

                    this.mytitle = '在线考试';
                    this.ListItem.InputUrl = "OnlineexaminationInput.html?id=" + id + "&type=1&t=" + Date.parse(new Date());
                    this.ListItem.dialogVisible = true;
                },
                MK: function (val, id, state, extype) {
                    if (extype == '线下') {
                        showMessage("请参与线下考试！", "error")
                        return;
                    }
                    if (state != '已开始') {
                        showMessage("培训已开始状态才能参与考试！", "error")
                        return;
                    }
                    this.mytitle = '模拟考试';
                    this.ListItem.InputUrl = "OnlineexaminationInput.html?id=" + id + "&type=0&t=" + Date.parse(new Date());
                    this.ListItem.dialogVisible = true;
                },

                //Model 替换成 表名
                GetPageData: function (currentIndex) {
                    GetPageData(this, currentIndex, '/api/PX_Plan/WDPX')
                },

                onSubmit: function () {
                    onSubmit(this);
                },

                handleSizeChange: function (val) {
                    handleSizeChange(this, val);
                },

                handleCurrentChange: function (val) {
                    handleCurrentChange(this, val);
                },

                handleNodeClick: function (data) {
                    this.formInline.model.Category = data.id;
                    this.GetPageData(1);
                }
            }
        });
    </script>

</body>

</html>